/**
 * 
 */
package com.hfjyz.examination.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.hfjyz.examination.command.CategoryEditCommand;

/**
 *
 */
public class CategoryEditValidator implements Validator {

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public boolean supports(Class clazz) {
		return clazz.isAssignableFrom(CategoryEditCommand.class);
	}

	@Override
	public void validate(Object target, Errors errors) {

		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name",
				"error.category.name", "please input category name.");

	}

}
